.TH std::filesystem::path::root_name 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::filesystem::path::root_name \- std::filesystem::path::root_name

.SH Synopsis
   path root_name() const;  \fI(since C++17)\fP

   Returns the root name of the generic-format path. If the path (in generic format)
   does not include root name, returns path().

.SH Parameters

   \fI(none)\fP

.SH Return value

   The root name of the path.

.SH Exceptions

   May throw implementation-defined exceptions.

.SH Example


// Run this code

 #include <filesystem>
 #include <iostream>
 namespace fs = std::filesystem;

 int main()
 {
     std::cout << "Current root name is: " << fs::current_path().root_name() << '\\n';
 }

.SH Possible output:

 Current root name is: "C:"

.SH See also

   root_directory returns the root directory of the path, if present
                  \fI(public member function)\fP
   root_path      returns the root path of the path, if present
                  \fI(public member function)\fP
